component (React)
Reactのコンポーネントのこと
ReactのMain Concept:4. Components and Props#5b93b2c83f44250000a40a82
図で見るComponent
Stateful vs. Stateless Functional Components in React
https://gyazo.com/2961851603e60c2f3ba21a365ae815aa
Pure Component
React Top-Level API – React
React.Component doesn’t implement shouldComponentUpdate(), but React.PureComponent implements it with a shallow prop and state comparison.
If your React component’s render() function renders the same result given the same props and state, you can use React.PureComponent for a performance boost in some cases.
prop/stateがnestしないときには積極的につかいたい
nestするときにはfalse-negativeになる場合がある(ドキュメント参照)
コンポーネント設計
https://www.gabe.pizza/notes-on-component-libraries/
どのようにコンポーネントを設計すれば、正しく使われるコンポーネントが作れるのかについて書かれています。
間違った使われ方をしないような設計やメジャーアップデート時にcodemodでのマイグレーション、ビジュアルリグレッションテストなどについて書かれています。
https://jser.info/2022/06/21/internet-explorer-11-vue-2.7-beta-react/
DigitalOceanの事例
2017末時点での React Component 設計のベストプラクティス - Qiita
React (TypeScript): ベストプラクティス - Qiita(2019年01月)
Writing Resilient Components — Overreacted(2019年3月) by Dan Abramov
実例でみるcomponent
JSの例
Mastodon:https://github.com/tootsuite/mastodon/tree/master/app/javascript/mastodon/components
https://dev.to/juanmaguitar/comment/3eh3
TypeScriptをつかってCSS in JSでReact componentを書く